﻿@{
    ViewBag.Title = "Withdraw";
    Layout = "~/Views/Shared/_LayoutMember.cshtml";
    var Member = Session["LoginUser"] as Domain.Model.User;
    var Bank = ViewData["UserBank"] as Domain.Model.UserBank;
}

@model Domain.Model.Withdraw


@section Script
{
    <link href="~/Content/mvcpage/jquery.mvcpage.css" rel="stylesheet" />
    <script src="~/Content/mvcpage/jquery.mvcpage.js"></script>

    <script type="text/javascript">
        $(function () {
            $(".pagectrl").mvcPage({
                url: '/member/WithdrawPage',
                callBack: function (html) {
                    $(".list").html(html);
                }
            });
        });

        function search() {
            $(".pagectrl").mvcPage('option').queryParam.keyword = $('#keyword').val();
            $(".pagectrl").mvcPage('reload');
        }
    </script>
}

<div class="fr2 green fs-25 Tbrline">提现申请</div>
<div class="fr2">

    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:void(0);">提现申请</a></li>
        <li><a href="javascript:void(0);">提现记录</a></li>
    </ul>


    <form class="form-horizontal">
        <div class="tab_box">
            <div >
                <div class="control-group">
                    <label class="control-label" for="inputEmail">会员编号/昵称</label>
                    <div class="controls">
                        <input type="text"  value="@Member.Account" readonly="readonly">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputPassword">提现类型</label>
                    <div class="controls">
                        <select id="ddlWithdrawType">
                            <option>奖金币钱包</option>
                        </select>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputPassword">余额</label>
                    <div class="controls">
                        <input type="password" id="inputPassword"  value="@Member.Bonus" readonly="readonly">
                    </div>
                </div>

                <div class="alert alert-success">银行资料</div>

                @if (Bank != null)
                {
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">银行名称</label>
                        <div class="controls">
                            <input type="text"  value="@Bank.Bank.GetDisplay()" readonly="readonly">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">账户</label>
                        <div class="controls">
                            <input type="text"   value="@Bank.Account" readonly="readonly">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">开户银行地址</label>
                        <div class="controls">
                            <input type="text"   value="@Bank.Address" readonly="readonly">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="inputEmail">户主姓名</label>
                        <div class="controls">
                            <input type="text"   value="@Bank.UserName" readonly="readonly">
                        </div>
                    </div>
                }

                <p class="text-error">
                    提现须知：请核对以上您的银行账户资料是否正确,如需修改请进入 
            <a class="btn btn-small" href="/Member/BankInfo"><i class="icon-th"></i>修改银行资料</a>
                </p>
           
                <div class="alert alert-success">提现信息</div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">提现金额</label>
                    <div class="controls">
                        @Html.TextBoxFor(i => i.WithdrawAmount, Html.ValidFor(i => i.WithdrawAmount))
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">实际提现金额</label>
                    <div class="controls">
                        @Html.TextBoxFor(i => i.NowAmount, Html.ValidFor(i => i.NowAmount))
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label" for="inputEmail">交易密码</label>
                    <div class="controls">
                        @Html.Password("password")
                    </div>
                </div>

                <div class="ui-row ui-row-sbtn">
                    <input type="button" value="提   交" class="sbtn" onclick="saveForm()" />
                </div>
            </div>
            <div class="hide" class="div2">
                <div class="alert alert-info">
                    <span>会员编号：@Member.Account</span>|<span>   昵称:@Member.NickName  </span>|<span>   合计：@ViewBag.Total</span>
                </div>

                <table class="table table-bordered">
                    <caption>
                    </caption>
                    <thead>
                        <tr>
                            <th>序号</th>
                            <th>银行名称</th>
                            <th>账户</th>
                            <th>户主姓名</th>
                            <th>提现类型</th>
                            <th>提现金额</th>
                            <th>手续费</th>
                            <th>实际金额￥</th>
                            <th>日期</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody class="list">
                    </tbody>

                </table>
                <div class="text-right pagectrl"></div>
            </div>
        </div>
    </form>

</div>

    <script type="text/javascript">
        var $div_li = $(".fr2 ul li");
        $div_li.click(function () {

            $(this).addClass("active").siblings().removeClass("active");

            var index = $div_li.index(this);
          
            $("div.tab_box>div")
                .eq(index).show()
               .siblings().hide();
 
        });

       

        //保存
        function saveForm() {
            $("form").validBox(function (r) {
                if (!r)
                    return;
                $.post("/member/SaveWithdraw", $("form").serialize(), function (data) {
                    if (data.state) {
                        window.messageBox("提示", "提现成功!");
                   
                        $('#password').val("");
                        $(".active").removeClass("active").siblings().addClass("active");
                        var index = $div_li.index(this);
                        $("div.tab_box>div")
                            .eq(index).show()
                           .siblings().hide();
                    }
                    else {
                        window.messageBox("提示", data.value);
                    }
                });
            });
        };
    </script>


